﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using HZ.MBSM.DBUtility;

public partial class System_Product_yaoli_Edit : System.Web.UI.Page {
    public string show;
    protected void Page_Load(object sender, EventArgs e) {
        if (HZ.MBSM.BLL.Login.CheckAssert(this.UseAccountType)) {
            HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)System.Web.HttpContext.Current.Session["Account"];
            if (int.Parse(_Account.Type) == 5) {
                this.show = "none";
            } else {
                this.show = "block";
            }

            if (!IsPostBack) {
                txtLSH.Text = MsgBox.JieMi_Decrypt(Request.QueryString["Productid"].ToString());
                txtProductCode.Text = MsgBox.JieMi_Decrypt(Request.QueryString["Productcode"].ToString());
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e) {
       try
       {           
           if (txtProductCode.Text.Length != 20) {
             
               Response.Write("<script>alert('药理编码必须为20位!');</script>");               
               return;
           }
           Db db = new Db();
           HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)System.Web.HttpContext.Current.Session["Account"];
           string sqlstr = "update product set productcode=" + SysFun.SqlStr(txtProductCode.Text) + ",remark='" + _Account.AccountName + "," + System.DateTime.Now.ToString() + "' where productid=" + SysFun.SqlStr(txtLSH.Text);
           db.Command(sqlstr);
           Response.Write("<script>alert('数据更新成功!');</script>");
           Response.Write("<script>window.opener.location.reload();window.close();</script>");
       }
       catch (System.Exception ex)
       {
           Response.Write("<script>alert(\"错误!\\n   " + ex.Message + "\");</script>");
         
       	
       }
      
       

    }
    #region IPageDescribe 成员

    public string Name {
        get { return "审核商品信息"; }
    }

    public string Describe {
        get { return "审核商品信息"; }
    }

    public string ParentName {
        get { return "商品维护"; }
    }

    public System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> UseAccountType {
        get {
            System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
            _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAdmin);
            _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAttorney);
            _AccountType.Add(HZ.MBSM.DAL.AccountType.enumCheckGoods);
            return _AccountType;
        }
    }
    #endregion
}
